import {createApp} from 'vue'
import App from './App.vue'
// reset style sheet
import "@/styles/reset.scss";
// CSS common style sheet
import "@/styles/common.scss";
// iconfont css
import "@/assets/iconfont/iconfont.scss";
// font css
import "@/assets/fonts/font.scss";
// element css
import "element-plus/dist/index.css";
// element dark css
import "element-plus/theme-chalk/dark/css-vars.css";
// custom element dark css
import "@/styles/element-dark.scss";
// custom element css
import "@/styles/element.scss";
// svg icons
import "virtual:svg-icons-register";
// element plus
import ElementPlus from "element-plus";
// element icons
import * as ElementPlusIcons from "@element-plus/icons-vue";
// custom directives
import directives from "@/directives/index.js";
// vue Router
import router from "@/routers";
// vue i18n
import I18n from "@/languages/index";
// pinia store
import pinia from "@/stores";
// errorHandler
import errorHandler from "@/utils/errorHandler";
// vue-grid-layout布局
import VueGridLayout from 'vue-grid-layout'
// markdown 编辑器
import mavonEditor from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'


import '@/utils/browserPatch.js'

/**  引入图标库   **/
import Unicon from 'vue-unicons'
// import {
//     uniLayerGroupMonochrome,
//     uniCarWash,
//     uniYoutubeThinline
// } from 'vue-unicons/dist/icons'
//
// Unicon.add([uniLayerGroupMonochrome,
//     uniCarWash,
//     uniYoutubeThinline])
import * as Icons from 'vue-unicons/dist/icons.js'

let icons = []
Object.entries(Icons).map((value, index) => {
    // console.log(value[1])
    icons.push(value[1])
})
Unicon.add(icons)
/**
 * name	        Icon name	        string	-	-
 * width	    Width of icon	    string	-	-
 * height	    Height of icon	    string	-	-
 * fill	        Fill color of icon	string	HEX or color name	-
 * hover-fill	Fill color on hover	string	HEX or color name	-
 * icon-style	Icon style	        string	line/monochrome/solid/thinline	line
 *线/单色/实体/细线
 * **/


/**  挂载全局事件总线   **/
import mitt from 'mitt';

window.$eventBus = mitt();

import Qs from 'qs'

window.qs = Qs



const app = createApp(App);

// app.config.errorHandler = errorHandler;

// 注册element Icons 组件
// Object.keys(ElementPlusIcons).forEach(key => {
//     app.component(key, Icons);
// });
for (const [key, component] of Object.entries(ElementPlusIcons)) {
    app.component(key, component)
}
app.use(Unicon)
app.use(mavonEditor)
app.use(ElementPlus).use(directives).use(router).use(I18n).use(pinia).use(VueGridLayout).mount("#app");

